Fix the handling of modality by copying what GtkFileChooserButton does.
authorMatthias Clasen <mclasen@redhat.com>
Wed, 24 May 2006 19:44:20 +0000 (19:44 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 24 May 2006 19:44:20 +0000 (19:44 +0000)
2006-05-24  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkfontbutton.c (gtk_font_button_clicked):
* gtk/gtkcolorbutton.c (gtk_color_button_clicked):
Fix the handling of modality by copying what
GtkFileChooserButton does.  (#342754, Yevgen Muntyan)

ChangeLog
ChangeLog.pre-2-10
gtk/gtkcolorbutton.c
gtk/gtkfontbutton.c

index bb69c3515d2b1b9c92ade9634c50f529a6dd6fc8..e53f1cfb101c3359af095d0cbe5ed2ced9bc50a4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2006-05-24  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkfontbutton.c (gtk_font_button_clicked): 
+       * gtk/gtkcolorbutton.c (gtk_color_button_clicked): 
+       Fix the handling of modality by copying what
+       GtkFileChooserButton does.  (#342754, Yevgen Muntyan)
+       
        * gtk/gtkprintunixdialog.c (create_main_page): Make
        the range entry insensitive if another range option
        is selected.  (#342783, Caolan McNamara)
index bb69c3515d2b1b9c92ade9634c50f529a6dd6fc8..e53f1cfb101c3359af095d0cbe5ed2ced9bc50a4 100644 (file)
@@ -1,5 +1,10 @@
 2006-05-24  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkfontbutton.c (gtk_font_button_clicked): 
+       * gtk/gtkcolorbutton.c (gtk_color_button_clicked): 
+       Fix the handling of modality by copying what
+       GtkFileChooserButton does.  (#342754, Yevgen Muntyan)
+       
        * gtk/gtkprintunixdialog.c (create_main_page): Make
        the range entry insensitive if another range option
        is selected.  (#342783, Caolan McNamara)
index ac2c6d3154b1321feb72734bc0d56511a950f1d0..a917cd22f56524426deb0a541a8d6c77ff76b03a 100644 (file)
@@ -710,9 +710,14 @@ gtk_color_button_clicked (GtkButton *button)
       
       color_dialog = GTK_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);
 
-      if (parent)
-        gtk_window_set_transient_for (GTK_WINDOW (color_dialog),
-                                      GTK_WINDOW (parent));
+      if (GTK_WIDGET_TOPLEVEL (parent) && GTK_IS_WINDOW (parent))
+        {
+          if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (color_dialog)))
+           gtk_window_set_transient_for (GTK_WINDOW (color_dialog), GTK_WINDOW (parent));
+              
+         gtk_window_set_modal (GTK_WINDOW (color_dialog),
+                               gtk_window_get_modal (GTK_WINDOW (parent)));
+       }
       
       g_signal_connect (color_dialog->ok_button, "clicked",
                         G_CALLBACK (dialog_ok_clicked), color_button);
@@ -720,10 +725,6 @@ gtk_color_button_clicked (GtkButton *button)
                        G_CALLBACK (dialog_cancel_clicked), color_button);
       g_signal_connect (color_dialog, "destroy",
                         G_CALLBACK (dialog_destroy), color_button);
-      
-      /* If there is a grabbed window, set new dialog as modal */
-      if (gtk_grab_get_current ())
-        gtk_window_set_modal (GTK_WINDOW (color_button->priv->cs_dialog),TRUE);
     }
 
   color_dialog = GTK_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);
index 59f4b20e98607905814c8767f0a843dee1f28b02..2f1814434f05aeb828458adcd4aa4aff1085ad23 100644 (file)
@@ -697,12 +697,14 @@ gtk_font_button_clicked (GtkButton *button)
       
       font_dialog = GTK_FONT_SELECTION_DIALOG (font_button->priv->font_dialog);
       
-      if (parent)
-        gtk_window_set_transient_for (GTK_WINDOW (font_dialog), GTK_WINDOW (parent));
-      
-      /* If there is a grabbed window, set new dialog as modal */
-      if (gtk_grab_get_current ())
-        gtk_window_set_modal (GTK_WINDOW (font_dialog), TRUE);
+      if (GTK_WIDGET_TOPLEVEL (parent) && GTK_IS_WINDOW (parent))
+        {
+          if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (font_dialog)))
+           gtk_window_set_transient_for (GTK_WINDOW (font_dialog), GTK_WINDOW (parent));
+              
+         gtk_window_set_modal (GTK_WINDOW (font_dialog),
+                               gtk_window_get_modal (GTK_WINDOW (parent)));
+       }
 
       g_signal_connect (font_dialog->ok_button, "clicked",
                         G_CALLBACK (dialog_ok_clicked), font_button);